<?php $this->load->view('admin/public/head.html', array('css' => array(
'/assets/admin/css/admin/common.css'
))); ?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" ng-controller="admin-cashin-sets-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            资金管理
            <small>用户资金流管理模块</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active">充值套餐</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">

            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">套餐管理</h3>
                        <div class="box-tools">
                            <div class="input-group input-group-sm" style="width: 150px;">
                                <div class="input-group-btn">
                                    <a href="javascript:void(0);" ng-click="showAddModal()" class="btn btn-success pull-right">
                                        <i class="fa fa-plus"></i>
                                        增加套餐
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-striped">
                            <tr>
                                <th class="text-center" style="width: 50px">#</th>
                                <th class="text-center" style="width: 80px;">套餐名称</th>
                                <th class="text-center">金额</th>
                                <th>描述</th>
                                <th class="text-center" style="width: 100px;">已充值（人）</th>
                                <th class="text-center" style="width: 140px;">创建时间</th>
                                <th class="text-center" style="width: 60px;">状态</th>
                                <th class="text-center" style="width: 170px">操作</th>
                            </tr>
                            <tr ng-hide="!meals.length" ng-repeat="m in meals">
                                <td class="text-center" ng-bind="m.id"></td>
                                <td class="text-center" ng-bind="m.name"></td>
                                <td class="text-center" style="color: red;" ng-bind="'￥ ' + m.amount_format"></td>
                                <td ng-bind="m.description"></td>
                                <td class="text-center" ng-bind="m.members"></td>
                                <td class="text-center" ng-bind="m.created"></td>
                                <td class="text-center">
                                    <span class="badge bg-maroon" ng-hide="m.status==6">禁用</span>
                                    <span class="badge bg-green" ng-hide="m.status==5">正常</span>
                                </td>
                                <td class="text-center">
                                    <a class="btn btn-link btn-xs" href="javascript:void(0);" ng-click="edit(m)"><i class="fa fa-pencil"></i> 编辑</a>
                                    <a href="javascript:void(0);" style="color: red;" ng-hide="m.status == 5" class="btn btn-xs btn-link" ng-click="changeStatus(m)"><i class="fa fa-arrow-down"></i> 禁用</a>
                                    <a href="javascript:void(0);" style="color: green;" ng-hide="m.status == 6" class="btn btn-xs btn-link" ng-click="changeStatus(m)"><i class="fa fa-arrow-up"></i> 开启</a>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-link" ng-click="remove(m)"><i class="fa fa-trash"></i> 删除</a>
                                </td>
                            </tr>
                            <tr ng-show="!meals.length">
                                <td colspan="8" class="text-center">
                                    <p class="help-block">暂无记录</p>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>

        </div>
    </section>
    <!-- /.content -->

    <!-- 模态框 -->
    <div class="modal fade" id="cashModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" ng-bind="type == 'add' ? '添加套餐' : '编辑套餐'"></h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="alert alert-danger alert-dismissible" ng-hide="!error.show">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4><i class="icon fa fa-ban"></i> 操作提示</h4>
                                <p ng-bind="error.msg"></p>
                            </div>
                            <!-- form start -->
                            <form class="form-horizontal">
                                <div class="box-body">

                                    <div class="form-group">
                                        <label for="email" class="col-sm-2 control-label">套餐名称</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control"
                                                   ng-model="item.name" id="email" placeholder="套餐名称,如:A套餐">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="password" class="col-sm-2 control-label">设置金额</label>
                                        <div class="col-sm-9">
                                            <input type="number" class="form-control"
                                                   ng-model="item.amount_yun"
                                                   id="password"
                                                   placeholder="设置套餐金额,单位（元）">
                                            <p class="help-block">请确认微信或支付宝限制支付金额,以免超过限额用户无法充值</p>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label for="password" class="col-sm-2 control-label">套餐描述</label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" ng-model="item.description" rows="3"
                                                      placeholder="套餐描述内容..."></textarea>
                                        </div>
                                    </div>
                                </div>
                                <!-- /.box-body -->
                            </form>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-success" ng-click="submit()">立即提交</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
</div>

<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array(
    'js' => array(
        '/assets/admin/js/money/cashin_sets.js',
    )
)); ?>
